--- ../tk4.1/generic/tkMenu.c	Wed Mar 27 14:53:39 1996
+++ tkMenu.c	Mon Jul  8 19:24:12 1996
@@ -14,7 +14,11 @@
  *
  * SCCS: @(#) tkMenu.c 1.102 96/03/26 16:07:08
  */
-
+/*
+ * TkSTEP modifications Copyright
+ * by Alfredo K. Kojima 
+ */ 
+ 
 #include "tkPort.h"
 #include "default.h"
 #include "tkInt.h"
@@ -403,8 +407,8 @@
  * Various geometry definitions:
  */
 
-#define CASCADE_ARROW_HEIGHT 10
-#define CASCADE_ARROW_WIDTH 8
+#define CASCADE_ARROW_HEIGHT 8
+#define CASCADE_ARROW_WIDTH 7
 #define DECORATION_BORDER_WIDTH 2
 #define MARGIN_WIDTH 2
 
@@ -1636,7 +1640,7 @@
 	    maxAccelWidth = width;
 	}
 	if (mePtr->type == SEPARATOR_ENTRY) {
-	    mePtr->height = 8;
+	    mePtr->height = 0; /*8;*/
 	}
 	if (mePtr->type == TEAROFF_ENTRY) {
 	    mePtr->height = 12;
@@ -1679,6 +1683,7 @@
     if (height <= 0) {
 	height = 1;
     }
+    width+=2;
     if ((width != Tk_ReqWidth(menuPtr->tkwin)) ||
 	    (height != Tk_ReqHeight(menuPtr->tkwin))) {
 	Tk_GeometryRequest(menuPtr->tkwin, width, height);
@@ -1724,13 +1729,33 @@
     XFontStruct *fontPtr;
     int index, baseline, strictMotif, leftEdge, y,  height;
     GC gc;
-    XPoint points[3];
 
     menuPtr->flags &= ~REDRAW_PENDING;
     if ((menuPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
 	return;
     }
 
+    /* 
+     * Draw Window border before
+     */
+    if (menuPtr->transient) {	
+	Tk_Draw3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin),
+		menuPtr->border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin),
+		menuPtr->borderWidth, menuPtr->relief);
+    } else {
+	XDrawLine(menuPtr->display, Tk_WindowId(tkwin), 
+	    	Tk_3DBorderGC(tkwin, menuPtr->border, TK_3D_LIGHT_GC),
+	    	0,0, Tk_Width(tkwin)-1, 0);
+	XDrawLine(menuPtr->display, Tk_WindowId(tkwin), 
+	    	Tk_3DBorderGC(tkwin, menuPtr->border, TK_3D_LIGHT_GC),
+	    	0, 0, 0, Tk_Height(tkwin));
+	XDrawLine(menuPtr->display, Tk_WindowId(tkwin), 
+	    	Tk_3DBorderGC(tkwin, menuPtr->border, TK_3D_DARK_GC),
+	    	Tk_Width(tkwin)-1, 0, Tk_Width(tkwin)-1, Tk_Height(tkwin));
+	XDrawLine(menuPtr->display, Tk_WindowId(tkwin),
+	      	Tk_3DBorderGC(tkwin, menuPtr->border, TK_3D_DARK_GC),
+	  	0, Tk_Height(tkwin), Tk_Width(tkwin)-1, Tk_Height(tkwin));
+    }    
     /*
      * Loop through all of the entries, drawing them one at a time.
      */
@@ -1740,11 +1765,32 @@
 	    + menuPtr->activeBorderWidth;
     for (index = 0; index < menuPtr->numEntries; index++) {
 	mePtr = menuPtr->entries[index];
-	if (!(mePtr->flags & ENTRY_NEEDS_REDISPLAY)) {
+	if (mePtr->type==SEPARATOR_ENTRY) {
+	    continue;
+	}	
+	/* 
+	 * Draw top and bottom part of entry bevel 
+	 */
+	if (index!=0) {
+	    XDrawLine(menuPtr->display, Tk_WindowId(menuPtr->tkwin),
+		Tk_3DBorderGC(menuPtr->tkwin, menuPtr->border,
+		TK_3D_LIGHT_GC), 0, mePtr->y, Tk_Width(tkwin)-2, mePtr->y);
+	}
+	if (index<menuPtr->numEntries-1) {	    
+	    XDrawLine(menuPtr->display, Tk_WindowId(menuPtr->tkwin),
+	      	Tk_3DBorderGC(menuPtr->tkwin, menuPtr->border,
+		TK_3D_DARK_GC), 0, mePtr->y+mePtr->height-2, Tk_Width(tkwin)-1,
+		mePtr->y+mePtr->height-2);
+	    XDrawLine(menuPtr->display, Tk_WindowId(menuPtr->tkwin),
+		Tk_3DBorderGC(menuPtr->tkwin, menuPtr->border,
+		TK_3D_DARK2_GC), 0, mePtr->y+mePtr->height-1,Tk_Width(tkwin),
+		mePtr->y+mePtr->height-1);
+	}
+	
+	if (!(mePtr->flags & ENTRY_NEEDS_REDISPLAY)) {	    
 	    continue;
 	}
 	mePtr->flags &= ~ENTRY_NEEDS_REDISPLAY;
-
 	/*
 	 * Background.
 	 */
@@ -1753,25 +1799,22 @@
 	if (bgBorder == NULL) {
 	    bgBorder = menuPtr->border;
 	}
-	if (strictMotif) {
-	    activeBorder = bgBorder;
-	} else {
-	    activeBorder = mePtr->activeBorder;
-	    if (activeBorder == NULL) {
-		activeBorder = menuPtr->activeBorder;
-	    }
+	activeBorder = mePtr->activeBorder;
+	if (activeBorder == NULL) {
+	    activeBorder = menuPtr->activeBorder;
 	}
+	
 	if (mePtr->state == tkActiveUid) {
-	    bgBorder = activeBorder;
-	    Tk_Fill3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin),
-		    bgBorder, menuPtr->borderWidth, mePtr->y,
-		    Tk_Width(tkwin) - 2*menuPtr->borderWidth, mePtr->height,
-		    menuPtr->activeBorderWidth, TK_RELIEF_RAISED);
+	    XFillRectangle(menuPtr->display, Tk_WindowId(tkwin),
+		    Tk_3DBorderGC(tkwin,activeBorder,TK_3D_FLAT_GC), 
+		    menuPtr->borderWidth-1, mePtr->y+1,
+		    Tk_Width(tkwin)-2*menuPtr->borderWidth+1, mePtr->height-3);
+		    
 	} else {
-	    Tk_Fill3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin),
-		    bgBorder, menuPtr->borderWidth, mePtr->y,
-		    Tk_Width(tkwin) - 2*menuPtr->borderWidth, mePtr->height,
-		    0, TK_RELIEF_FLAT);
+	    XFillRectangle(menuPtr->display, Tk_WindowId(tkwin),
+		    Tk_3DBorderGC(tkwin,bgBorder,TK_3D_FLAT_GC), 
+		    menuPtr->borderWidth-1, mePtr->y+1,
+		    Tk_Width(tkwin)-2*menuPtr->borderWidth+1, mePtr->height-3);
 	}
 
 	/*
@@ -1798,6 +1841,7 @@
 	    }
 	}
 
+	
 	/*
 	 * Draw label or bitmap or image for entry.
 	 */
@@ -1851,18 +1895,23 @@
 	 */
 
 	if (mePtr->type == CASCADE_ENTRY) {
-	    points[0].x = Tk_Width(tkwin) - menuPtr->borderWidth
+	    int x,u;
+
+	    x = Tk_Width(tkwin) - menuPtr->borderWidth 
 		    - menuPtr->activeBorderWidth - MARGIN_WIDTH
 		    - CASCADE_ARROW_WIDTH;
-	    points[0].y = mePtr->y + (mePtr->height - CASCADE_ARROW_HEIGHT)/2;
-	    points[1].x = points[0].x;
-	    points[1].y = points[0].y + CASCADE_ARROW_HEIGHT;
-	    points[2].x = points[0].x + CASCADE_ARROW_WIDTH;
-	    points[2].y = points[0].y + CASCADE_ARROW_HEIGHT/2;
-	    Tk_Fill3DPolygon(menuPtr->tkwin, Tk_WindowId(tkwin), activeBorder,
-		    points, 3, DECORATION_BORDER_WIDTH,
-		    (menuPtr->postedCascade == mePtr) ? TK_RELIEF_SUNKEN
-		    : TK_RELIEF_RAISED);
+	    y = mePtr->y + (mePtr->height - CASCADE_ARROW_HEIGHT)/2;
+  	    XDrawLine(menuPtr->display, Tk_WindowId(menuPtr->tkwin),
+		    Tk_3DBorderGC(menuPtr->tkwin, menuPtr->border, 
+		    TK_3D_DARK2_GC), x, y, x, y+CASCADE_ARROW_HEIGHT);
+	    XDrawLine(menuPtr->display, Tk_WindowId(menuPtr->tkwin),
+		    Tk_3DBorderGC(menuPtr->tkwin, menuPtr->border, 
+		    TK_3D_DARK_GC), x, y, x+CASCADE_ARROW_WIDTH, 
+		    y+CASCADE_ARROW_HEIGHT/2);
+	    XDrawLine(menuPtr->display, Tk_WindowId(menuPtr->tkwin),
+		    Tk_3DBorderGC(menuPtr->tkwin, menuPtr->border, 
+		    TK_3D_LIGHT_GC), x, y+CASCADE_ARROW_HEIGHT, 
+		    x+CASCADE_ARROW_WIDTH, y+CASCADE_ARROW_HEIGHT/2);
 	} else if (mePtr->accel != NULL) {
 	    TkDisplayChars(menuPtr->display, Tk_WindowId(tkwin), gc,
 		    fontPtr, mePtr->accel, mePtr->accelLength,
@@ -1887,13 +1936,13 @@
 	    y = mePtr->y + (mePtr->height - dim)/2;
 	    Tk_Fill3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin),
 		    menuPtr->border, x, y, dim, dim,
-		    DECORATION_BORDER_WIDTH, TK_RELIEF_SUNKEN);
+		    DECORATION_BORDER_WIDTH, TK_RELIEF_RAISED);
 	    x += DECORATION_BORDER_WIDTH;
 	    y += DECORATION_BORDER_WIDTH;
 	    dim -= 2*DECORATION_BORDER_WIDTH;
 	    if ((dim > 0) && (mePtr->flags & ENTRY_SELECTED)) {
-		XFillRectangle(menuPtr->display, Tk_WindowId(tkwin), gc,
-			x, y, (unsigned int) dim, (unsigned int) dim);
+		Tk_DrawCheckMark(menuPtr->display, tkwin, Tk_WindowId(tkwin),
+			x, y-3, menuPtr->border);
 	    }
 	}
 
@@ -1902,47 +1951,29 @@
 	 */
 
 	if ((mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn) {
-	    XPoint points[4];
 	    int radius;
+	    int x, y;
 
-	    radius = mePtr->indicatorDiameter/2;
-	    points[0].x = menuPtr->borderWidth + menuPtr->activeBorderWidth
+	    radius = mePtr->indicatorDiameter/2-1;
+	    x = menuPtr->borderWidth + menuPtr->activeBorderWidth
 		    + (menuPtr->indicatorSpace - mePtr->indicatorDiameter)/2;
-	    points[0].y = mePtr->y + (mePtr->height)/2;
-	    points[1].x = points[0].x + radius;
-	    points[1].y = points[0].y + radius;
-	    points[2].x = points[1].x + radius;
-	    points[2].y = points[0].y;
-	    points[3].x = points[1].x;
-	    points[3].y = points[0].y - radius;
+	    y = mePtr->y + (mePtr->height-mePtr->indicatorDiameter)/2;
+	    Tk_Draw3DCircle(menuPtr->display, tkwin, Tk_WindowId(tkwin),
+		x, y, menuPtr->borderWidth, radius, TK_RELIEF_SUNKEN,
+		menuPtr->border);
 	    if (mePtr->flags & ENTRY_SELECTED) {
-		XFillPolygon(menuPtr->display, Tk_WindowId(tkwin), gc,
-			points, 4, Convex, CoordModeOrigin);
+		gc = Tk_3DBorderGC(tkwin, menuPtr->border, TK_3D_LIGHT_GC);
+		XFillArc(menuPtr->display, Tk_WindowId(tkwin), gc, 
+		     x+menuPtr->borderWidth, y+menuPtr->borderWidth, 
+		     radius*2-menuPtr->borderWidth-1,
+		     radius*2-menuPtr->borderWidth-1,0,360*64);
 	    } else {
-		Tk_Fill3DPolygon(menuPtr->tkwin, Tk_WindowId(tkwin),
-			menuPtr->border, points, 4, DECORATION_BORDER_WIDTH,
-			TK_RELIEF_FLAT);
-	    }
-	    Tk_Draw3DPolygon(menuPtr->tkwin, Tk_WindowId(tkwin),
-		    menuPtr->border, points, 4, DECORATION_BORDER_WIDTH,
-		    TK_RELIEF_SUNKEN);
-	}
-
-	/*
-	 * Draw separator.
-	 */
-
-	if (mePtr->type == SEPARATOR_ENTRY) {
-	    XPoint points[2];
-	    int margin;
-
-	    margin = (fontPtr->ascent + fontPtr->descent)/2;
-	    points[0].x = 0;
-	    points[0].y = mePtr->y + mePtr->height/2;
-	    points[1].x = Tk_Width(tkwin) - 1;
-	    points[1].y = points[0].y;
-	    Tk_Draw3DPolygon(menuPtr->tkwin, Tk_WindowId(tkwin),
-		    menuPtr->border, points, 2, 1, TK_RELIEF_RAISED);
+		gc = Tk_3DBorderGC(tkwin, menuPtr->border, TK_3D_FLAT_GC);
+		XFillArc(menuPtr->display, Tk_WindowId(tkwin), gc, 
+		     x+menuPtr->borderWidth, y+menuPtr->borderWidth, 
+		     radius*2-menuPtr->borderWidth-1,
+		     radius*2-menuPtr->borderWidth-1,0,360*64);
+	    }	    
 	}
 
 	/*
@@ -1955,7 +1986,7 @@
 
 	    margin = (fontPtr->ascent + fontPtr->descent)/2;
 	    points[0].x = 0;
-	    points[0].y = mePtr->y + mePtr->height/2;
+	    points[0].y = mePtr->y + mePtr->height/2-1;
 	    points[1].y = points[0].y;
 	    width = 6;
 	    maxX  = Tk_Width(tkwin) - 1;
@@ -2004,9 +2035,7 @@
 		height, 0, TK_RELIEF_FLAT);
     }
 
-    Tk_Draw3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin),
-	    menuPtr->border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin),
-	    menuPtr->borderWidth, menuPtr->relief);
+
 }
 
 /*
